//
//  UIButton+Extention.swift
//  StudySwift
//
//  Created by tomato on 2021/8/30.
//  Copyright © 2021 fan. All rights reserved.
//

import UIKit
 
extension UIButton {
    //‘便利’构造函数 convenience修饰
    //一般对系统的类进行扩充
    convenience init(imageName:String,backImageName:String){
        self.init()//必须写
        setImage(UIImage(named:imageName), for: UIControl.State.normal)
        setImage(UIImage(named:imageName + "_highlighted"), for: UIControl.State.highlighted)
        setBackgroundImage(UIImage(named:backImageName), for: UIControl.State.normal)
        setBackgroundImage(UIImage(named:backImageName+" _highlighted"), for: UIControl.State.highlighted)
        //会根据图片的大小调整尺寸
        sizeToFit();//
    }
    
    //类函数
    class func createButton(title:String){
         
    }
}
